#include "frmcourseday.h"
#include "ui_frmcourseday.h"

FrmCourseDay::FrmCourseDay(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FrmCourseDay)
{
    ui->setupUi(this);

    this->initForm();
}

FrmCourseDay::~FrmCourseDay()
{
    delete ui;
}

void FrmCourseDay::initForm()
{
    this->setDateEditFormat(ui->dtEStart);
    this->setDateEditFormat(ui->dtEEnd);
    this->setDateEditFormat(ui->dtExclude);
}

void FrmCourseDay::setDateEditFormat(QDateEdit *dEdit)
{
    QCustomCalendarWidget * calendarWidget = new QCustomCalendarWidget(this);
    dEdit->setCalendarPopup(true);  // 日历弹出
    dEdit->setCalendarWidget(calendarWidget);
    dEdit->setMinimumDate(QDate::currentDate().addDays(0));  // 0天
    dEdit->setMaximumDate(QDate::currentDate().addDays(365));  // +365天
    dEdit->setContextMenuPolicy(Qt::NoContextMenu);
    dEdit->setFixedSize(100, 26);
    dEdit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
}
